﻿using System.Collections.Generic;
using Sessionizer.Samples.Model;
using Sessionizer.Samples.Sessionized.Rankers.Cheater;
using Sessionizer.Samples.Sessionized.Rankers.Database;
using Sessionizer.Samples.Sessionized.Rankers.InitalOrder;
using Sessionizer.Samples.Sessionized.Rankers.NameLength;

namespace Sessionizer.Samples.Sessionized.Rankers
{
    public sealed class ConcreteRankerProvider : IRankerProvider
    {
        private readonly CheaterRanker _cheaterRanker;
        private readonly DatabaseRanker _databaseRanker;
        private readonly InitalOrderRanker _initalOrderRanker;
        private readonly NameLengthRanker _nameLengthRanker;
        
        /// <summary>
        /// Let IoC container resove their dependencies for us
        /// </summary>
        public ConcreteRankerProvider
            (
            NameLengthRanker nameLengthRanker,
            DatabaseRanker databaseRanker,
            CheaterRanker cheaterRanker,
            InitalOrderRanker initalOrderRanker
            )
        {
            _nameLengthRanker = nameLengthRanker;
            _databaseRanker = databaseRanker;
            _cheaterRanker = cheaterRanker;
            _initalOrderRanker = initalOrderRanker;
        }

        public IEnumerable<IRanker> GetRankers()
        {
            yield return _nameLengthRanker;
            yield return _databaseRanker;
            yield return _cheaterRanker;
            yield return _initalOrderRanker;
        }
    }
}